ci: add static feature self-tests that run on every PR#24
Merged
Conversation
Adds a fast, dependency-free guard (Node's built-in test runner, no Electron/DOM) that runs as a PR check to catch regressions before merge - e.g. the duplicate _selectFolder method that silently broke the Select Folder button and Alt+F. Checks: (1) all src JS parses; (2) no class defines the same method twice; (3) global hotkeys stay wired and Alt+F/Esc are handled before the typing-target guard; (4) every data-action button has an act() handler; (5) the author signature stays an inline SVG. - test/selftest.test.js: the suite (node --test) - package.json: npm test script - .github/workflows/selftest.yml: runs node --test on push/PR to main (ubuntu, no npm install)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a fast, dependency-free self-test that runs as a check on every PR, so modifying one thing can't silently break another (e.g. the keyboard shortcuts).
It is pure static analysis — no Electron, no DOM, no
npm install— so it finishes in seconds onubuntu-latestvia Node's built-in test runner.What it guards (5 checks)
src/**/*.jspassesnode --check._selectFoldermethods; the later one silently shadowed the first). Verified: the pre-fix file had 2 defs, current has 1.Tab.data-actionin index.html has a matchingact()handler (no dead buttons).<svg class="gh-icon">(guards the "GH" text regression).Runs as a PR check
.github/workflows/selftest.ymltriggers onpull_request+pushtomain, so it shows up as a required-style status check on PRs automatically. Run locally withnpm test.Files
test/selftest.test.js— the suite (node --test)package.json— adds thetestscript.github/workflows/selftest.yml— the PR workflowExtending
Add another
test(...)block intest/selftest.test.js— the helpers (classesIn,tabMethodNames) are reusable.